# GNAFU - "Ground, Navy and Air Fuck-Up" real-time strategy game
# Copyright (C) 2008-2009 k0wax <k0waxk0wax@gmail.com>
#
# This file is part of GNAFU.
#
# GNAFU is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNAFU is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNAFU.  If not, see <http://www.gnu.org/licenses/>.

"""Generic tanks' module"""
from __future__ import division, absolute_import
from src import unit, entity, geom, loaders, sprite, views, field
from src.units.components.z1turret import Z1Turret

@loaders.load_props('units/common/generic_tank')
class GenericTank(unit.BaseUnit):
    """generic class for tanks"""
    unittype = unit.unittypes.tank
    surface_type = field.surface_types.land # XXX FIX
    def __init__(self, *args, **kw):
        super(GenericTank, self).__init__(*args, **kw)
        self.turret = Z1Turret()
        self.turret.set_parent(self)
        self.components.append(self.turret)
    def fire(self):
        self.turret.fire()

class GenericTankView(object):
    def __init__(self):
        self.spr = sprite.DirSprite(parent=self)
    def draw(self):
        self.spr.draw()
        self.turret.draw()
